<template>
  <wang-edior v-model="articleContent" class="wang-editor-class" />
</template>

<script setup lang="ts">
import { ref } from 'vue';
import WangEdior from '@/components/WangEdior/index.vue';

const articleContent = ref('<p>开始编写你的文章...</p>');

const documentContent = ref('<p>开始编写你的文档...</p>');

const onContentChange = (html: string) => {
  documentContent.value = html;
  console.log('内容已更新:', html);
};
</script>

<style scoped>
.notion-page {
  width: 100%;
  height: 100vh;
  background: #ffffff;
}
.article-editor-fullscreen {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
}

.editor-section,
.preview-section {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.section-header {
  padding: 16px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.section-content {
  flex: 1;
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 确保编辑器组件占满可用空间 */
:deep(.tiptap-editor) {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

:deep(.editor-content) {
  flex: 1;
  overflow-y: auto;
}

:deep(.tiptap-preview) {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

:deep(.preview-content) {
  flex: 1;
  overflow-y: auto;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .article-editor-fullscreen {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .editor-section,
  .preview-section {
    height: 50vh;
  }
}

@media (max-width: 768px) {
  .section-header {
    padding: 12px 16px;
  }

  .section-content {
    padding: 16px;
  }

  .section-header h2 {
    font-size: 1.125rem;
  }
}
</style>
